<?php


namespace App\Topics;


use App\Core\Ioc;
use App\Job\QueueContract;

abstract class Topics
{

    public $process_num = 5;

    public $name = 'default';

    public $max_tries = 3;


    public function handler(Ioc $app)
    {
        $queue = $app->make(QueueContract::class);
        while (true) {
            $job = $queue->dequeue($this->name);
            if ($job) {
                $job->handle();
                continue;
            }
            sleep(3);
        }
    }
}